let SYSTEM_INFO = uni.getSystemInfoSync();
//获取手机状态栏高度
export const getStatusBarHeight = () => SYSTEM_INFO.statusBarHeight || 15;

//获取微信小程序的胶囊按钮高度
export const getTitleBarHeight = () => {
  //如果有这个方法
  try {
    if(uni.getMenuButtonBoundingClientRect()) {
      // console.log('有这个方法')
      let { top, height } = uni.getMenuButtonBoundingClientRect();
      return height + (top - getStatusBarHeight())*2;
    } else {
      return 40; // 默认值
    }
  } catch (error) {
    console.log('没有这个方法')
    return 40; // 默认值
  } 
}

//获取填充空间的高度
export const getFillHeight = () => getStatusBarHeight() + getTitleBarHeight();

//获取底部安全区的高度
export const getBottomSafeHeight = () => SYSTEM_INFO.safeAreaInsets.bottom || 0;
